<?php
include_once "DBConnect.php";
include_once "GlobalSetting.php";
setlocale(LC_ALL, 'IND');
mysql_query('SET CHARACTER SET utf8');
$con = mysql_connect($dbhost, $dbuser,$dbpasswd );
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $con);
$sql_ustadz = "SELECT up.* FROM ustadz_list ul,user_profile up WHERE up.userid = ul.user_id order by up.name asc";
$result = mysql_query($sql_ustadz);
$ret = array();
$ind = 0;
while($row = mysql_fetch_array($result))
{
	$ret[$ind]['userid']	= $row['userid'];
	$ret[$ind]['screen_name']= utf8_encode($row['screen_name']);
	$ret[$ind]['name']= ""; 
	if($row['name'] != NULL){
		$ret[$ind]['name']	= utf8_encode($row['name']);
	}
	$ret[$ind]['description'] ="";
	if($row['description'] != NULL){
		$ret[$ind]['description']= utf8_encode($row['description']);
		
	}
	$ret[$ind]['location']	= $row['location'];
	$ret[$ind]['profile_img_url']	= $row['profile_img_url'];
	$ret[$ind]['url']	= $row['url'];
	$ind++;
}
mysql_free_result($result);
$sql_visit_track = "INSERT INTO visitor_tracker(page_visited, ip_addr) VALUES('UstadzProfile','$_SERVER[REMOTE_ADDR]')";
mysql_query($sql_visit_track,$con);
mysql_close($con);
echo json_encode($ret, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE); 

?>